package com.dong.factoryMode;

import com.dong.factoryMode.service.ICommodity;
import com.dong.factoryMode.service.impl.CardCommodityImpl;
import com.dong.factoryMode.service.impl.CouponCommodityImpl;
import com.dong.factoryMode.service.impl.GoodsCommodityImpl;

/**
 * @author DongJiaQi
 * @create 2022/12/20 10:53
 * @Description: 商店⼯⼚
 */
public class StoreFactory {
    public ICommodity getCommodityService(Integer commodityType) {
        if (null == commodityType) return null;
        if (1 == commodityType) return new CouponCommodityImpl();
        if (2 == commodityType) return new GoodsCommodityImpl();
        if (3 == commodityType) return new CardCommodityImpl();
        throw new RuntimeException("不存在的商品服务类型");
    }
}
